﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLZJFurnitureSCM.DAL;
using QLZJFurnitureSCM.Model;

namespace QLZJFurnitureSCM.BLL
{
    public class ContactService
    {
        private IBaseDAO<Contact> baseDAO = new ContactDAO();

        public Contact Insert(Contact contact)
        {
            return baseDAO.Create(contact);
        }

        public bool Update(Contact contact)
        {
            return baseDAO.Update(contact);
        }

        public List<Contact> FindAllContacts()
        {
            return baseDAO.ReadAll();
        }

        public bool Delete(Contact contact)
        {
            return baseDAO.Delete(contact);
        }

        public bool DeleteBatch(List<Contact> lstContact)
        {
            foreach (Contact contact in lstContact)
            {
                if (!Delete(contact))
                    return false;
            }
            return true;
        }
        
    }
}
